import QtQuick 2.0
Item {
    width: 100; height: 10
    function bestDelegate(t) {
        if(t === 1)
          return redSquare;
        return greenSquare; // t == "text"
      }

    Component {
        id: redSquare

        Text {
            text: sid + ": " + value
            color: "red"
        }
    }
    Component {
        id: greenSquare

        Text {
            text: sid + ": " + value
            color: "green"
        }
    }

    Loader { sourceComponent: bestDelegate(rgVal - lfVal); x: 20 }
}



